<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>用户管理</title>
    <link href="./static/bootstrap/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>


<div class="container main">
    <div class="mt-4 mb-4">
        <ul class="nav nav-tabs ">
            <li class="nav-item">
                <a class="nav-link active" aria-current="page" href="userList">用户管理</a>
            </li>
        </ul>
    </div>
    <article class="mb-4">
        <form class="form-inline" action="${pageContext.request.contextPath}/userList" method="post">
            <div class="row">
                <div class="col-md-3">
                    <input type="text" class="form-control" id="id" placeholder="请输入ID" value="${id}" name="id">
                </div>
                <div class="col-md-3">
                    <input type="text" class="form-control" id="name" placeholder="请输入姓名"
                           value="${name}" name="name">
                </div>
                <div class="col-md-3">
                    <button type="submit" class="btn btn-primary">查询</button>

                    <a class="btn btn-primary btn-xs" href="${pageContext.request.contextPath}/userCreate.jsp">新增</a>
                </div>
            </div>
        </form>
    </article>
    <table class="table table-bordered table-hover table-striped" th:id="table">
        <tr>
            <td>ID</td>
            <td>用户名</td>
            <td>姓名</td>
            <td>操作</td>
        </tr>
        <c:forEach items="${list}" var="item">
            <tr>
                <td>${item.id}</td>
                <td>${item.username}</td>
                <td>${item.name}</td>
                <td>
                    <div class="action">
                        <a class="btn btn-primary btn-sm"
                           href="${pageContext.request.contextPath}/userUpdate?id=${item.id}">编辑</a>
                        <a class="btn btn-danger btn-sm"
                           href="${pageContext.request.contextPath}/userRemove?id=${item.id}">删除</a>
                    </div>
                </td>
            </tr>
        </c:forEach>
    </table>
</div>

<script src="./static/bootstrap/js/bootstrap.bundle.min.js"></script>
</body>
</html>
